package practice;

import org.openqa.selenium.Alert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

import org.openqa.selenium.By;

public class Interview {
	public static void main(String[] args) {
		WebDriver driver=new FirefoxDriver();
		driver.get("file:///F:/Helios-Workspace/WebDriver/TestDataWebDriver/jscriptpopup.htm");
		driver.findElement(By.xpath("//input[@value='Show alert box']")).click();
		Alert alert = driver.switchTo().alert();
		System.out.println(alert.getText());
		alert.accept();
		driver.quit();
		
		
		driver.get("http://somedomain/url_that_delays_loading");
		WebElement myDynamicElement = (new WebDriverWait(driver, 10))
		  .until(new ExpectedCondition<WebElement>(){
			@Override
			public WebElement apply(WebDriver d) {
				return d.findElement(By.id("myDynamicElement"));
			}});
		
		
	}
}